<template>
  <div class="d-flex jc-center dbdh">
    <div class="title">{{ title }}</div>
  </div>
</template>

<script>
import { formatTime } from "../../utils/index.js";
export default {
  data() {
    return {
      timing: null,
      interval: null,
      dateDayMinte: null,
      checked: 1,
      showMenu: false,
      inMenu: false,
      menus: [
        {
          id: 1,
          name: '车辆管理',
          router: '/car-manage'
        },{
          id: 2,
          name: '订单服务',
          router: '/car-manage2'
        },{
          id: 3,
          name: '车辆与订单',
          router: '/car-manage3'
        },{
          id: 4,
          name: '时空',
          router: '/car-manage4'
        },
      ]
    };
  },
  props: {
      title: String,
  },
  mounted() {
    this.timeFn();
  },
  methods: {
    timeFn() {
      this.interval = setInterval(() => {
        this.dateDayMinte = formatTime(new Date(), "yyyy-MM-dd HH: mm");
      }, 1000);
    },
    intoMenu() {
      this.showMenu = true
      clearTimeout(this.timing)
      this.timing = setTimeout(() => {
        if (!this.inMenu) {
          this.showMenu = false
        }
        this.timing = null
        clearTimeout(this.timing)
      }, 1000)
    },
    leaveMenu() {
      if (!this.timing) {
        this.timing = setTimeout(() => {
          if (!this.inMenu) {
            this.showMenu = false
          }
          this.timing = null
        }, 500)
      }
    }
  },
};
</script>

<style lang="scss" scoped>
.dbdh {
  width: 100%;
  height: 75px;
  // background-image: url("../../assets/icon/dbdh.png"); // 标题背景图
  background-position: 0%;
  background-repeat: no-repeat;
  background-size: 100% 75px;
  font-family: "PanMenZhengDao";
  font-size: 2.3rem;
  line-height: 40px;


  display: flex;
  justify-content: space-between;
  align-items: center;

  .title {
    height: 100%;
    flex: 1;
    line-height: 60px;
    text-align: center;
  }
}

</style>